import request from '@/utils/request'

export const reqGetEmployees = () => {
  return request({
    url: '/sys/user/simple'
  })
}

export function reqGetEmployeeList(page, size) {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

export function reqDelEmployee(id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}

export function reqAddEmployee(data) {
  return request({
    method: 'post',
    url: '/sys/user',
    data
  })
}

export function reqImportBatch(data) {
  return request({
    method: 'post',
    url: '/sys/user/batch',
    data
  })
}

/** **
 * 获取用户的岗位信息  (岗位信息)
 * ****/
export function reqGetJobDetail(id) {
  return request({
    method: 'get',
    url: `/employees/${id}/jobs`
  })
}

/**
 * 保存岗位信息  (岗位信息)
 * ****/
export function reqUpdateJob(data) {
  return request({
    method: 'put',
    url: `/employees/${data.userId}/jobs`,
    data
  })
}

export function reqGetEmployeeSimple() {
  return request({
    method: 'get',
    url: '/sys/user/simple'
  })
}

/** *
 * 给员工分配角色
 * ***/
export function reqAssignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
